In [1]:
import pandas as pd
from sklearn.tree import DecisionTreeClassifier
from sklearn.metrics import classification_report
from sklearn.model_selection import train_test_split
from sklearn.model_selection import GridSearchCV
In [2]:
german_credit=pd.read_csv('GermanCredit.csv')
In [3]:
german_credit.head()
Out[3]:
Duration Amount InstallmentRatePercentage ResidenceDuration Age NumberExistingCredits NumberPeopleMaintenance Telephone ForeignWorker Class ... OtherInstallmentPlans.Bank OtherInstallmentPlans.Stores OtherInstallmentPlans.None Housing.Rent Housing.Own Housing.ForFree Job.UnemployedUnskilled Job.UnskilledResident Job.SkilledEmployee Job.Management.SelfEmp.HighlyQualified
0 6 1169 4 4 67 2 1 0 1 Good ... 0 0 1 0 1 0 0 0 1 0
1 48 5951 2 2 22 1 1 1 1 Bad ... 0 0 1 0 1 0 0 0 1 0
2 12 2096 2 3 49 1 2 1 1 Good ... 0 0 1 0 1 0 0 1 0 0
3 42 7882 2 4 45 1 2 1 1 Good ... 0 0 1 0 0 1 0 0 1 0
4 24 4870 3 4 53 2 2 1 1 Bad ... 0 0 1 0 0 1 0 0 1 0

5 rows × 62 columns

In [4]:
colNames=german_credit.columns
In [5]:
#reclassify 'class' variable, 0='Bad',1='Good'
german_credit['Class']=german_credit['Class'].replace('Good',1).replace('Bad',0)
In [6]:
german_credit.head(3)
Out[6]:
Duration Amount InstallmentRatePercentage ResidenceDuration Age NumberExistingCredits NumberPeopleMaintenance Telephone ForeignWorker Class ... OtherInstallmentPlans.Bank OtherInstallmentPlans.Stores OtherInstallmentPlans.None Housing.Rent Housing.Own Housing.ForFree Job.UnemployedUnskilled Job.UnskilledResident Job.SkilledEmployee Job.Management.SelfEmp.HighlyQualified
0 6 1169 4 4 67 2 1 0 1 1 ... 0 0 1 0 1 0 0 0 1 0
1 48 5951 2 2 22 1 1 1 1 0 ... 0 0 1 0 1 0 0 0 1 0
2 12 2096 2 3 49 1 2 1 1 1 ... 0 0 1 0 1 0 0 1 0 0

3 rows × 62 columns

In [7]:
X=german_credit.drop('Class',axis=1)
y=german_credit.Class
In [8]:
from sklearn.model_selection import train_test_split
X_train, X_test, y_train, y_test = train_test_split(X,y,test_size = 0.3,random_state=3)
In [9]:
clf = DecisionTreeClassifier(max_depth=2)
In [10]:
clf.fit(X_train,y_train)
Out[10]:
DecisionTreeClassifier(max_depth=2)
In [11]:
y_pred = clf.predict(X_test)
y_pred
Out[11]:
array([1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1,
       0, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 0,
       1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1,
       1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
       0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1,
       0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 1,
       1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1, 1,
       0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1,
       0, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
       1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1,
       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 0, 1, 1,
       1, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
       0, 1, 0, 1, 1, 1, 1, 0, 1, 0, 1, 1, 0, 1], dtype=int64)
In [12]:
from sklearn import metrics 
Accuracy = metrics.accuracy_score(y_test,y_pred)
Accuracy
Out[12]:
0.7
In [13]:
target = [0,1]
print(classification_report(y_test, y_pred))
              precision    recall  f1-score   support

           0       0.46      0.36      0.41        85
           1       0.77      0.83      0.80       215

    accuracy                           0.70       300
   macro avg       0.62      0.60      0.60       300
weighted avg       0.68      0.70      0.69       300

In [14]:
#Let's use Gride dearch to get best parameter and later check accuracy and classification report
In [15]:
grid={'criterion':['gini','entropy'],
                  'max_depth':[90,100,110],
     'min_samples_split':[8,10,12]}

clf_2=DecisionTreeClassifier()
tree_cv=GridSearchCV(clf_2,grid,cv=10,n_jobs=5,verbose=10)

tree_cv.fit(X_train,y_train)

print("tuned hyperparameters :(best parameters) ",tree_cv.best_params_)
print("accuracy :",tree_cv.best_score_)
Fitting 10 folds for each of 18 candidates, totalling 180 fits
[Parallel(n_jobs=5)]: Using backend LokyBackend with 5 concurrent workers.
[Parallel(n_jobs=5)]: Done   3 tasks      | elapsed:    1.9s
[Parallel(n_jobs=5)]: Done   8 tasks      | elapsed:    2.0s
[Parallel(n_jobs=5)]: Done  15 tasks      | elapsed:    2.0s
[Parallel(n_jobs=5)]: Done  22 tasks      | elapsed:    2.0s
[Parallel(n_jobs=5)]: Batch computation too fast (0.1641s.) Setting batch_size=2.
[Parallel(n_jobs=5)]: Done  31 tasks      | elapsed:    2.0s
[Parallel(n_jobs=5)]: Batch computation too fast (0.0247s.) Setting batch_size=4.
[Parallel(n_jobs=5)]: Done  45 tasks      | elapsed:    2.0s
[Parallel(n_jobs=5)]: Batch computation too fast (0.0440s.) Setting batch_size=8.
[Parallel(n_jobs=5)]: Done  79 tasks      | elapsed:    2.1s
[Parallel(n_jobs=5)]: Batch computation too fast (0.1080s.) Setting batch_size=16.
[Parallel(n_jobs=5)]: Done 152 out of 180 | elapsed:    2.3s remaining:    0.3s
[Parallel(n_jobs=5)]: Done 180 out of 180 | elapsed:    2.3s finished
tuned hyperparameters :(best parameters)  {'criterion': 'gini', 'max_depth': 90, 'min_samples_split': 12}
accuracy : 0.7285714285714286
In [16]:
clf_2.fit(X_train,y_train)
y_pred = clf_2.predict(X_test)
y_pred
Out[16]:
array([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 1, 1,
       1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 0,
       0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 1, 1,
       1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1, 0,
       1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1,
       1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1,
       1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 1, 0,
       1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1,
       0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0,
       1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1,
       1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1,
       1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1,
       1, 0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1,
       0, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0], dtype=int64)
In [17]:
Accuracy = metrics.accuracy_score(y_test,y_pred)
Accuracy
Out[17]:
0.66
In [18]:
target = [0,1]
print(classification_report(y_test, y_pred))
              precision    recall  f1-score   support

           0       0.40      0.42      0.41        85
           1       0.77      0.75      0.76       215

    accuracy                           0.66       300
   macro avg       0.59      0.59      0.59       300
weighted avg       0.66      0.66      0.66       300

In [19]:
#! pip install dtreeviz
In [20]:
import sys
import os
# add library module to PYTHONPATH
sys.path.append(f"{os.getcwd()}/../")
In [19]:
from sklearn.datasets import *
from dtreeviz.trees import *
from IPython.display import Image, display_svg, SVG
In [22]:
#import os
#os.environ["PATH"] += os.pathsep + r'C:\Users\deepa\anaconda3\pkgs\graphviz-2.38-hfd603c8_2\Library\bin'
In [20]:
viz = dtreeviz(clf_2,
               X_train,
               y_train,
               target_name='Class',  # this name will be displayed at the leaf node
               feature_names=X.columns,
               title="German Credit data set regression",
               fontname="Arial",
               title_fontsize=16,
               colors = {"title":"purple"}
              )
viz
Out[20]:
G German Credit data set regression cluster_legend node16 2021-06-07T16:03:37.345692 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ leaf17 2021-06-07T16:04:41.752762 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node16->leaf17 leaf18 2021-06-07T16:04:41.877791 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node16->leaf18 node14 2021-06-07T16:03:37.721878 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node14->node16 node19 2021-06-07T16:03:38.514031 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ leaf15 2021-06-07T16:04:41.630373 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node14->leaf15 node21 2021-06-07T16:03:38.084973 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ leaf22 2021-06-07T16:04:42.122896 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node21->leaf22 leaf23 2021-06-07T16:04:42.288190 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node21->leaf23 node19->node21 leaf20 2021-06-07T16:04:41.999466 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node19->leaf20 node13 2021-06-07T16:03:38.967906 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node13->node14 node13->node19 leaf24 2021-06-07T16:04:42.426894 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node12 2021-06-07T16:03:39.541869 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node12->node13 node12->leaf24 node10 2021-06-07T16:03:40.009213 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node10->node12 leaf11 2021-06-07T16:04:41.479751 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node10->leaf11 node8 2021-06-07T16:03:40.507008 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node8->node10 leaf9 2021-06-07T16:04:41.307412 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node8->leaf9 leaf25 2021-06-07T16:04:42.577009 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node7 2021-06-07T16:03:40.943055 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node7->node8 node26 2021-06-07T16:03:43.282568 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node7->leaf25 node32 2021-06-07T16:03:41.411422 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ leaf33 2021-06-07T16:04:42.994844 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node32->leaf33 leaf34 2021-06-07T16:04:43.112743 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node32->leaf34 node30 2021-06-07T16:03:41.891088 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node30->node32 leaf31 2021-06-07T16:04:42.864499 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node30->leaf31 leaf35 2021-06-07T16:04:43.244419 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node29 2021-06-07T16:03:42.342899 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node29->node30 node29->leaf35 leaf36 2021-06-07T16:04:43.401913 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node28 2021-06-07T16:03:42.830186 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node28->node29 node28->leaf36 node26->node28 leaf27 2021-06-07T16:04:42.720422 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node26->leaf27 node6 2021-06-07T16:03:43.750582 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node6->node7 node6->node26 node37 2021-06-07T16:03:58.969770 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node40 2021-06-07T16:03:44.221293 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ leaf41 2021-06-07T16:04:43.543509 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node40->leaf41 leaf42 2021-06-07T16:04:43.691530 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node40->leaf42 leaf43 2021-06-07T16:04:43.847039 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node39 2021-06-07T16:03:44.855545 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node39->node40 node44 2021-06-07T16:03:48.136635 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node39->leaf43 node46 2021-06-07T16:03:45.346511 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ leaf47 2021-06-07T16:04:43.993108 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node46->leaf47 leaf48 2021-06-07T16:04:44.164708 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node46->leaf48 leaf49 2021-06-07T16:04:44.343802 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node45 2021-06-07T16:03:45.834265 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node45->node46 node50 2021-06-07T16:03:47.679726 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node45->leaf49 node53 2021-06-07T16:03:46.292619 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ leaf54 2021-06-07T16:04:44.488906 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node53->leaf54 leaf55 2021-06-07T16:04:44.641001 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node53->leaf55 leaf56 2021-06-07T16:04:44.774921 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node52 2021-06-07T16:03:46.773431 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node52->node53 node52->leaf56 leaf57 2021-06-07T16:04:44.943916 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node51 2021-06-07T16:03:47.234222 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node51->node52 node51->leaf57 leaf58 2021-06-07T16:04:45.689804 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node50->node51 node50->leaf58 node44->node45 node44->node50 node38 2021-06-07T16:03:48.619942 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node38->node39 node38->node44 node59 2021-06-07T16:03:58.610344 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node64 2021-06-07T16:03:49.124586 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ leaf65 2021-06-07T16:04:45.834218 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node64->leaf65 leaf66 2021-06-07T16:04:46.002882 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node64->leaf66 leaf67 2021-06-07T16:04:46.183368 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node63 2021-06-07T16:03:49.630464 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node63->node64 node63->leaf67 leaf68 2021-06-07T16:04:46.326304 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node62 2021-06-07T16:03:50.094303 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node62->node63 node69 2021-06-07T16:03:51.219225 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node62->leaf68 node71 2021-06-07T16:03:50.761641 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ leaf72 2021-06-07T16:04:46.694241 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node71->leaf72 leaf73 2021-06-07T16:04:46.828474 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node71->leaf73 node69->node71 leaf70 2021-06-07T16:04:46.471117 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node69->leaf70 node61 2021-06-07T16:03:51.708868 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node61->node62 node61->node69 leaf74 2021-06-07T16:04:46.943050 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node60 2021-06-07T16:03:52.174104 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node60->node61 node75 2021-06-07T16:03:58.255076 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node60->leaf74 node81 2021-06-07T16:03:52.631144 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ leaf82 2021-06-07T16:04:47.260111 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node81->leaf82 leaf83 2021-06-07T16:04:47.408185 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node81->leaf83 node79 2021-06-07T16:03:53.023578 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node79->node81 node84 2021-06-07T16:03:53.447891 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ leaf80 2021-06-07T16:04:47.101929 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node79->leaf80 leaf85 2021-06-07T16:04:47.551032 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node84->leaf85 leaf86 2021-06-07T16:04:47.696421 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node84->leaf86 node78 2021-06-07T16:03:53.918269 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node78->node79 node78->node84 node87 2021-06-07T16:03:55.320993 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node90 2021-06-07T16:03:54.390573 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ leaf91 2021-06-07T16:04:47.935015 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node90->leaf91 leaf92 2021-06-07T16:04:48.080774 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node90->leaf92 node88 2021-06-07T16:03:54.845515 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node88->node90 leaf89 2021-06-07T16:04:47.815522 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node88->leaf89 leaf93 2021-06-07T16:04:48.219532 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node87->node88 node87->leaf93 node77 2021-06-07T16:03:55.778699 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node77->node78 node77->node87 node94 2021-06-07T16:03:56.239449 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ leaf95 2021-06-07T16:04:48.378822 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node94->leaf95 leaf96 2021-06-07T16:04:48.542274 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node94->leaf96 node76 2021-06-07T16:03:56.699616 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node76->node77 node76->node94 node97 2021-06-07T16:03:57.864386 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node99 2021-06-07T16:03:57.180757 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ leaf100 2021-06-07T16:04:48.848631 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node99->leaf100 leaf101 2021-06-07T16:04:49.105871 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node99->leaf101 node97->node99 leaf98 2021-06-07T16:04:48.709173 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node97->leaf98 node75->node76 node75->node97 node59->node60 node59->node75 node37->node38 node37->node59 node5 2021-06-07T16:03:59.359749 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node5->node6 node5->node37 leaf102 2021-06-07T16:04:49.286730 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node4 2021-06-07T16:03:59.811370 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node4->node5 node103 2021-06-07T16:04:00.306537 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node4->leaf102 leaf104 2021-06-07T16:04:49.418682 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node103->leaf104 leaf105 2021-06-07T16:04:49.576249 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node103->leaf105 node3 2021-06-07T16:04:00.781335 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node3->node4 node3->node103 node106 2021-06-07T16:04:01.724093 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node107 2021-06-07T16:04:01.262704 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ leaf108 2021-06-07T16:04:49.721795 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node107->leaf108 leaf109 2021-06-07T16:04:49.874828 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node107->leaf109 leaf110 2021-06-07T16:04:50.015391 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node106->node107 node106->leaf110 node2 2021-06-07T16:04:02.218118 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node2->node3 node2->node106 node111 2021-06-07T16:04:24.379638 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node123 2021-06-07T16:04:02.717488 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ leaf124 2021-06-07T16:04:50.542595 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node123->leaf124 leaf125 2021-06-07T16:04:50.694755 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node123->leaf125 node121 2021-06-07T16:04:03.211051 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node121->node123 leaf122 2021-06-07T16:04:50.388605 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node121->leaf122 node119 2021-06-07T16:04:03.677053 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node119->node121 leaf120 2021-06-07T16:04:50.265487 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node119->leaf120 node117 2021-06-07T16:04:04.117765 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node117->node119 leaf118 2021-06-07T16:04:50.141576 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node117->leaf118 leaf126 2021-06-07T16:04:50.860543 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node116 2021-06-07T16:04:04.617170 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node116->node117 node116->leaf126 leaf127 2021-06-07T16:04:51.011708 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node115 2021-06-07T16:04:05.106113 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node115->node116 node115->leaf127 leaf128 2021-06-07T16:04:51.155416 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node114 2021-06-07T16:04:05.598936 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node114->node115 node129 2021-06-07T16:04:18.978772 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node114->leaf128 node139 2021-06-07T16:04:06.029224 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ leaf140 2021-06-07T16:04:51.692207 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node139->leaf140 leaf141 2021-06-07T16:04:51.829873 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node139->leaf141 node137 2021-06-07T16:04:06.753862 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node137->node139 leaf138 2021-06-07T16:04:51.522674 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node137->leaf138 leaf142 2021-06-07T16:04:51.939907 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node136 2021-06-07T16:04:07.185093 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node136->node137 node143 2021-06-07T16:04:07.687353 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node136->leaf142 leaf144 2021-06-07T16:04:52.052852 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node143->leaf144 leaf145 2021-06-07T16:04:52.173151 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node143->leaf145 node135 2021-06-07T16:04:08.165257 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node135->node136 node135->node143 node146 2021-06-07T16:04:10.579967 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node151 2021-06-07T16:04:08.621960 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ leaf152 2021-06-07T16:04:52.414380 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node151->leaf152 leaf153 2021-06-07T16:04:52.541935 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node151->leaf153 node149 2021-06-07T16:04:09.107483 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node149->node151 leaf150 2021-06-07T16:04:52.293339 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node149->leaf150 leaf154 2021-06-07T16:04:52.673084 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node148 2021-06-07T16:04:09.589037 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node148->node149 node148->leaf154 leaf155 2021-06-07T16:04:52.790790 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node147 2021-06-07T16:04:10.073268 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node147->node148 node147->leaf155 leaf156 2021-06-07T16:04:52.901561 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node146->node147 node146->leaf156 node134 2021-06-07T16:04:11.088411 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node134->node135 node134->node146 node132 2021-06-07T16:04:11.575030 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node132->node134 leaf133 2021-06-07T16:04:51.302391 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node132->leaf133 leaf157 2021-06-07T16:04:52.963645 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node131 2021-06-07T16:04:12.037354 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node131->node132 node131->leaf157 leaf158 2021-06-07T16:04:53.047678 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node130 2021-06-07T16:04:12.510013 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node130->node131 node159 2021-06-07T16:04:18.504043 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node130->leaf158 node164 2021-06-07T16:04:12.981316 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ leaf165 2021-06-07T16:04:53.283440 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node164->leaf165 leaf166 2021-06-07T16:04:53.401444 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node164->leaf166 node162 2021-06-07T16:04:13.451700 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node162->node164 leaf163 2021-06-07T16:04:53.164572 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node162->leaf163 leaf167 2021-06-07T16:04:53.490884 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node161 2021-06-07T16:04:13.940630 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node161->node162 node168 2021-06-07T16:04:16.541944 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node161->leaf167 node171 2021-06-07T16:04:14.493070 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ leaf172 2021-06-07T16:04:53.599247 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node171->leaf172 leaf173 2021-06-07T16:04:53.721664 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node171->leaf173 leaf174 2021-06-07T16:04:53.837516 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node170 2021-06-07T16:04:14.999143 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node170->node171 node170->leaf174 leaf175 2021-06-07T16:04:53.955186 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node169 2021-06-07T16:04:15.494939 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node169->node170 node176 2021-06-07T16:04:16.010950 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node169->leaf175 leaf177 2021-06-07T16:04:54.078959 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node176->leaf177 leaf178 2021-06-07T16:04:54.204201 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node176->leaf178 node168->node169 node168->node176 node160 2021-06-07T16:04:17.071965 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node160->node161 node160->node168 node179 2021-06-07T16:04:17.574181 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ leaf180 2021-06-07T16:04:54.297438 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node179->leaf180 leaf181 2021-06-07T16:04:54.419977 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node179->leaf181 node159->node160 node159->node179 node129->node130 node129->node159 node113 2021-06-07T16:04:19.431294 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node113->node114 node113->node129 node182 2021-06-07T16:04:21.356448 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node183 2021-06-07T16:04:19.885393 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node186 2021-06-07T16:04:20.902724 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ leaf184 2021-06-07T16:04:54.541270 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node183->leaf184 leaf185 2021-06-07T16:04:54.660387 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node183->leaf185 node188 2021-06-07T16:04:20.372299 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ leaf189 2021-06-07T16:04:54.908098 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node188->leaf189 leaf190 2021-06-07T16:04:55.026676 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node188->leaf190 node186->node188 leaf187 2021-06-07T16:04:54.786773 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node186->leaf187 node182->node183 node182->node186 node112 2021-06-07T16:04:21.802200 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node112->node113 node112->node182 node191 2021-06-07T16:04:23.953006 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node192 2021-06-07T16:04:22.232911 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node195 2021-06-07T16:04:23.523786 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ leaf193 2021-06-07T16:04:55.148533 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node192->leaf193 leaf194 2021-06-07T16:04:55.248713 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node192->leaf194 node197 2021-06-07T16:04:22.704222 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ leaf198 2021-06-07T16:04:55.369728 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node197->leaf198 leaf199 2021-06-07T16:04:55.496320 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node197->leaf199 leaf200 2021-06-07T16:04:55.619238 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node196 2021-06-07T16:04:23.165823 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node196->node197 node196->leaf200 leaf201 2021-06-07T16:04:55.772972 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node195->node196 node195->leaf201 node191->node192 node191->node195 node111->node112 node111->node191 node1 2021-06-07T16:04:24.767576 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node1->node2 node1->node111 node202 2021-06-07T16:04:40.624302 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node207 2021-06-07T16:04:25.197838 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node210 2021-06-07T16:04:25.992110 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ leaf208 2021-06-07T16:04:55.912652 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node207->leaf208 leaf209 2021-06-07T16:04:56.070622 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node207->leaf209 node212 2021-06-07T16:04:25.602855 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ leaf213 2021-06-07T16:04:56.432771 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node212->leaf213 leaf214 2021-06-07T16:04:56.557095 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node212->leaf214 node210->node212 leaf211 2021-06-07T16:04:56.299914 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node210->leaf211 node206 2021-06-07T16:04:26.420540 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node206->node207 node206->node210 node215 2021-06-07T16:04:26.780099 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ leaf216 2021-06-07T16:04:56.690967 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node215->leaf216 leaf217 2021-06-07T16:04:56.832472 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node215->leaf217 node205 2021-06-07T16:04:27.181636 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node205->node206 node205->node215 node218 2021-06-07T16:04:28.004038 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node219 2021-06-07T16:04:27.646764 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ leaf220 2021-06-07T16:04:56.981808 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node219->leaf220 leaf221 2021-06-07T16:04:57.126528 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node219->leaf221 leaf222 2021-06-07T16:04:57.245000 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node218->node219 node218->leaf222 node204 2021-06-07T16:04:28.420913 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node204->node205 node204->node218 node223 2021-06-07T16:04:28.844238 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ leaf224 2021-06-07T16:04:57.362656 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node223->leaf224 leaf225 2021-06-07T16:04:57.481256 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node223->leaf225 node203 2021-06-07T16:04:29.194759 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node203->node204 node203->node223 node226 2021-06-07T16:04:40.231040 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node242 2021-06-07T16:04:29.622806 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node245 2021-06-07T16:04:32.509662 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ leaf243 2021-06-07T16:04:58.410683 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node242->leaf243 leaf244 2021-06-07T16:04:58.582675 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node242->leaf244 node249 2021-06-07T16:04:30.058322 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ leaf250 2021-06-07T16:04:58.914129 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node249->leaf250 leaf251 2021-06-07T16:04:59.058540 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node249->leaf251 leaf252 2021-06-07T16:04:59.190045 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node248 2021-06-07T16:04:30.415389 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node248->node249 node248->leaf252 node246 2021-06-07T16:04:31.288946 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node246->node248 node253 2021-06-07T16:04:32.134314 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ leaf247 2021-06-07T16:04:58.787095 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node246->leaf247 node255 2021-06-07T16:04:31.673188 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ leaf256 2021-06-07T16:04:59.520419 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node255->leaf256 leaf257 2021-06-07T16:04:59.677531 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node255->leaf257 node253->node255 leaf254 2021-06-07T16:04:59.350036 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node253->leaf254 node245->node246 node245->node253 node241 2021-06-07T16:04:32.902692 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node241->node242 node241->node245 node258 2021-06-07T16:04:33.709311 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node259 2021-06-07T16:04:33.349158 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ leaf260 2021-06-07T16:04:59.823537 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node259->leaf260 leaf261 2021-06-07T16:04:59.969377 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node259->leaf261 leaf262 2021-06-07T16:05:00.141556 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node258->node259 node258->leaf262 node240 2021-06-07T16:04:34.125245 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node240->node241 node240->node258 leaf263 2021-06-07T16:05:00.311790 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node239 2021-06-07T16:04:34.576535 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node239->node240 node239->leaf263 node237 2021-06-07T16:04:34.925501 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node237->node239 leaf238 2021-06-07T16:04:58.258756 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node237->leaf238 node235 2021-06-07T16:04:35.309672 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node235->node237 leaf236 2021-06-07T16:04:58.081621 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node235->leaf236 node233 2021-06-07T16:04:35.752305 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node233->node235 leaf234 2021-06-07T16:04:57.927815 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node233->leaf234 node231 2021-06-07T16:04:36.107586 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node231->node233 node264 2021-06-07T16:04:36.563398 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ leaf232 2021-06-07T16:04:57.775807 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node231->leaf232 leaf265 2021-06-07T16:05:00.463295 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node264->leaf265 leaf266 2021-06-07T16:05:00.633834 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node264->leaf266 node230 2021-06-07T16:04:36.990991 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node230->node231 node230->node264 node267 2021-06-07T16:04:39.027529 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node272 2021-06-07T16:04:37.349652 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ leaf273 2021-06-07T16:05:01.108636 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node272->leaf273 leaf274 2021-06-07T16:05:01.281828 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node272->leaf274 node270 2021-06-07T16:04:37.802388 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node270->node272 leaf271 2021-06-07T16:05:00.911666 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node270->leaf271 node268 2021-06-07T16:04:38.193234 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node268->node270 node275 2021-06-07T16:04:38.593105 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ leaf269 2021-06-07T16:05:00.790813 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node268->leaf269 leaf276 2021-06-07T16:05:02.149848 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node275->leaf276 leaf277 2021-06-07T16:05:02.292575 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node275->leaf277 node267->node268 node267->node275 node229 2021-06-07T16:04:39.439073 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node229->node230 node229->node267 leaf278 2021-06-07T16:05:02.460410 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node228 2021-06-07T16:04:39.802469 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node228->node229 node228->leaf278 node226->node228 leaf227 2021-06-07T16:04:57.623435 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node226->leaf227 node202->node203 node202->node226 node0 2021-06-07T16:04:40.992200 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/ node0->node1 ≤ node0->node202 > legend 2021-06-07T16:03:36.772805 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/
In [21]:
# Random Forests
In [22]:
from sklearn.ensemble import RandomForestClassifier
In [23]:
# Your code here! :)
clf = RandomForestClassifier(n_estimators=10,random_state=0)
In [24]:
import numpy as np
import matplotlib.pyplot as plt

from sklearn.datasets import make_classification
from sklearn.ensemble import ExtraTreesClassifier
In [25]:
clf.fit(X_train, y_train)
Out[25]:
RandomForestClassifier(n_estimators=10, random_state=0)
In [26]:
y_pred = clf.predict(X_test)
y_pred
Out[26]:
array([1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 1,
       0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0,
       1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 1, 1,
       1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0,
       1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1,
       1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1,
       1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0,
       1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1,
       1, 1, 0, 1, 1, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1,
       1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1,
       1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1,
       1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1,
       0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1,
       0, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0], dtype=int64)
In [27]:
target = [0,1]
print(classification_report(y_test, y_pred))
              precision    recall  f1-score   support

           0       0.51      0.47      0.49        85
           1       0.80      0.82      0.81       215

    accuracy                           0.72       300
   macro avg       0.66      0.65      0.65       300
weighted avg       0.72      0.72      0.72       300

In [29]:
plt.rc("figure", figsize=(16,8))
plt.rc("font", size=14)
In [30]:
clf.fit(X_train, y_train)
Accuracy=clf.score(X, y)
print('Accuracy:',Accuracy,'\n')

importFeature = clf.feature_importances_
feature_importances=pd.DataFrame([importFeature])

std = np.std([tree.feature_importances_ for tree in clf.estimators_],axis=0)
indices = np.argsort(importFeature)[::-1]

# Print the feature ranking
print("Feature ranking:")

# Plot the feature importances of the forest
plt.figure()
plt.title("Feature importances")
plt.bar(range(X.shape[1]), importFeature[indices],color="r", yerr=std[indices], align="center")
plt.xticks(range(X.shape[1]), indices)
plt.xlim([-1, X.shape[1]])
plt.show()

feature_importances=pd.DataFrame(pd.Series(colNames)[indices])
feature_importances['importance']=np.sort(importFeature)[::-1]
feature_importances.columns=['features','importance']
feature_importances
Accuracy: 0.911 

Feature ranking:
Out[30]:
features importance
1 Amount 0.104739
0 Duration 0.085347
4 Age 0.077534
12 CheckingAccountStatus.gt.200 0.052844
3 ResidenceDuration 0.033434
... ... ...
57 Housing.ForFree 0.001213
26 Purpose.Vacation 0.000863
22 Purpose.Radio.Television 0.000341
43 Personal.Male.Married.Widowed 0.000000
25 Purpose.Education 0.000000

61 rows × 2 columns

In [ ]: